package com.lee.config;

import com.lee.properties.ExtProperties;
import com.lee.service.ExtService;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zfl_a
 * @date 2020/8/7
 * @project redis-spring-boot-stater
 */
@Configuration
@EnableConfigurationProperties({ExtProperties.class})
public class ExtAutoConfiguration {

    /**
     * 交给Spring容器进行管理，缺失ExtService实例时该配置生效
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(ExtService.class)
    public ExtService extService(){
        return new ExtService();
    }
}
